package com.mall.thread.demo1;

public class RunnableDemo implements Runnable{
    private String name;
    public RunnableDemo(String name){
        this.name = name;
    }

    @Override
    public void run(){
        for (int i = 0; i < 5; i++) {
            int millis = (int) (Math.random() * 10);
            System.out.println(name + "执行  :  " + i+";休眠时间 : "+millis);
            try {
                Thread.sleep(millis);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

}
